Skip to content

[fix] Self-heal Playwright browser cache#4723

Open
mmabrouk wants to merge 1 commit into
release/v0.104.0from
codex/playwright-cache-fallback
Open

[fix] Self-heal Playwright browser cache#4723
mmabrouk wants to merge 1 commit into
release/v0.104.0from
codex/playwright-cache-fallback

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

Web Playwright jobs can fail before any test starts when GitHub Actions restores a stale ~/.cache/ms-playwright directory. The workflow previously skipped playwright install chromium whenever the cache hit, so a cache with the wrong browser revision stayed broken and surfaced as a misleading 0 passed, 0 failed, 0 skipped run.

Changes

The Playwright browser cache key now includes web/pnpm-lock.yaml, with a restore prefix for older caches. After restoring the cache, the workflow always runs pnpm exec playwright install chromium with a short retry loop. A valid cache remains fast because the install is a no-op; a stale restored cache downloads the missing browser and can be saved under the new lockfile-specific key.

Tests / notes

  • Ran git diff --check for .github/workflows/12-check-unit-tests.yml.
  • Commit hooks ran during commit. Ruff, Prettier, and Turbo had no matching staged files; gitleaks passed.
  • This mirrors the fallback pattern already used in .github/workflows/44-railway-tests.yml.

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 17, 2026 6:26pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Enhanced reliability of test infrastructure with improved retry mechanisms for dependency installation
    • Optimized caching strategy for test dependencies to ensure more consistent and efficient test execution

Walkthrough

The CI workflow for web unit tests updates the Playwright binaries cache key to include a hash of web/pnpm-lock.yaml. The conditional browser-install step (which only ran on cache miss) is replaced with a step that unconditionally runs Playwright installation inside a 3-attempt retry loop, failing the job after all attempts are exhausted.

Changes

Playwright Browser Install Hardening

Layer / File(s) Summary
Cache key update and retry-based browser install
.github/workflows/12-check-unit-tests.yml
Cache key now includes hashFiles('web/pnpm-lock.yaml'). The prior cache-miss-gated install step is replaced with an unconditional step that retries Playwright browser installation up to 3 times (with per-attempt timeout) and fails the job on final failure.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title '[fix] Self-heal Playwright browser cache' clearly and specifically summarizes the main change: fixing the Playwright browser cache to self-repair stale entries.
Description check ✅ Passed The description is directly related to the changeset, providing context about the cache issue, explaining the specific changes made, and noting validation steps performed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/playwright-cache-fallback

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mmabrouk mmabrouk marked this pull request as ready for review June 17, 2026 18:31
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 17, 2026
@mmabrouk mmabrouk changed the base branch from main to release/v0.104.0 June 17, 2026 18:31
@dosubot dosubot Bot added the ci/cd label Jun 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/12-check-unit-tests.yml (1)

85-86: 💤 Low value

Optional: Remove unused step ID.

The id: restore-playwright-cache is no longer referenced now that the browser install step runs unconditionally. Consider removing it to reduce confusion.

♻️ Proposed cleanup
       - name: Cache Playwright binaries
-        id: restore-playwright-cache
         if: github.event_name != 'workflow_dispatch' || contains(fromJSON('["all","web-only"]'), inputs.packages)

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b7229b9c-42be-455b-b140-864d0bdbc9c1

📥 Commits

Reviewing files that changed from the base of the PR and between 5722ff7 and e4fb43e.

📒 Files selected for processing (1)
  • .github/workflows/12-check-unit-tests.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant